package menu

import (
	"embed"

	"fyne.io/fyne/v2"
)

func MainMenuu(srcs embed.FS, a fyne.App) *fyne.MainMenu {
	return fyne.NewMainMenu(
		fyne.NewMenu("Tools", fyne.NewMenuItem(
			"Json2Struct", func() {
				Json2Struct()
			},
		),

			fyne.NewMenuItem(
				"json filter", func() {
					jsonfilter()
				},
			), 
		),

		fyne.NewMenu("About",
			fyne.NewMenuItem(
				"Log", func() {
					wlog := a.NewWindow("Log")
					wlog.Resize(fyne.NewSize(800, 500))
					wlog.SetContent(LogEntry)
					wlog.Show()
				},
			), fyne.NewMenuItem(
				"Clear Log", func() {
					LogBuf.Reset()
					LogEntry.SetText("")
				},
			), fyne.NewMenuItem(
				"Sources", func() {
					Srcui(srcs)
				}), fyne.NewMenuItem(
				"Build Info", func() {
					buildinfo()
				}), 
		))
}
